home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / liboctave / pathsearch.h < prev    next >
C/C++ Source or Header  |  1996-03-03  |  2KB  |  93 lines

  1. /*
  2.  
  3. Copyright (C) 1996 John W. Eaton
  4.  
  5. This file is part of Octave.
  6.  
  7. Octave is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. Octave is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Octave; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. */
  22.  
  23. #if !defined (octave_pathsearch_h)
  24. #define octave_pathsearch_h 1
  25.  
  26. #include <string>
  27.  
  28. #include "str-vec.h"
  29.  
  30. class
  31. dir_path
  32. {
  33. public:
  34.  
  35.   dir_path (const string& s = string ()) : p (s), initialized (false)
  36.     {
  37.       if (! p.empty ())
  38.     init ();
  39.     }
  40.  
  41.   dir_path (const dir_path& dp)
  42.     : p (dp.p), initialized (dp.initialized), pv (dp.pv) { }
  43.  
  44.   dir_path& operator = (const dir_path& dp)
  45.     {
  46.       p = dp.p;
  47.       initialized = dp.initialized;
  48.       pv = dp.pv;
  49.       return *this;
  50.     }
  51.  
  52.   ~dir_path (void) { }
  53.  
  54.   void set (const string& s)
  55.     {
  56.       initialized = false;
  57.       p = s;
  58.       init ();
  59.     }
  60.  
  61.   string_vector elements (void);
  62.   string_vector all_directories (void);
  63.  
  64.   string find_first (const string&);
  65.   string find (const string& nm) { return find_first (nm); }
  66.  
  67.   string_vector find_all (const string&);
  68.  
  69. private:
  70.  
  71.   // The colon separated list.
  72.   string p;
  73.  
  74.   // TRUE means we've unpacked p.
  75.   bool initialized;
  76.  
  77.   // The elements of the list.
  78.   string_vector pv;
  79.  
  80.   // TRUE means we've set the global value of kpathsea_debug.
  81.   static bool kpathsea_debug_initialized;
  82.  
  83.   void init (void);
  84. };
  85.  
  86. #endif
  87.  
  88. /*
  89. ;;; Local Variables: ***
  90. ;;; mode: C++ ***
  91. ;;; End: ***
  92. */
  93.